#ifdef VERTEX
uniform mat4 uProjMatrix;
uniform mat4 uViewMatrix;
uniform mat4 uModelMatrix;
uniform float uPointSize;
uniform vec4 uBaseColor;

layout(location = 0) in vec4 aPosition;
layout(location = 1) in vec2 aTexCoord;
layout(location = 2) in vec4 aNormal;
layout(location = 3) in vec4 aColor;

out vec4 vColor;

void main()
{
	vColor = aColor * uBaseColor;
	gl_PointSize = uPointSize;
	gl_Position = uProjMatrix * uViewMatrix * uModelMatrix * aPosition;
}
#endif

#ifdef FRAGMENT
uniform vec3 uEmissiveColor;

in vec4 vColor;
out vec4 fragColor;

void main()
{
	if (vColor.a < 0.01) discard;
	vec4 color = vec4(vColor.rgb + uEmissiveColor, vColor.a);

#ifdef ENABLE_TONEMAPPING
	color = common_tonemapping(color);
#endif
	fragColor = color;
}
#endif